home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / games / nhak_src.zip / ALLOC.C < prev    next >
C/C++ Source or Header  |  1993-03-16  |  985b  |  43 lines

  1. /*    SCCS Id: @(#)alloc.c    3.0    89/11/15
  2. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  3. /* NetHack may be freely redistributed.  See license for details. */
  4.  
  5. /* since this file is also used in auxiliary programs, don't include all the 
  6.  * function declarations for all of nethack
  7.  */
  8. #define EXTERN_H    /* comment line for pre-compiled headers */
  9. #include "config.h"
  10. long *FDECL(alloc,(unsigned int));
  11.  
  12. #ifdef LINT
  13. /*
  14.    a ridiculous definition, suppressing
  15.     "possible pointer alignment problem" for (long *) malloc()
  16.    from lint
  17. */
  18. long *
  19. alloc(n) unsigned int n; {
  20. long dummy = ftell(stderr);
  21.     if(n) dummy = 0;    /* make sure arg is used */
  22.     return(&dummy);
  23. }
  24.  
  25. #else
  26. #ifndef __TURBOC__
  27. extern void VDECL(panic, (const char *,...));
  28.  
  29. long *
  30. alloc(lth)
  31. register unsigned int lth;
  32. {
  33.     register genericptr_t ptr;
  34.  
  35.     if(!(ptr = malloc(lth)))
  36.         panic("Cannot get %d bytes", lth);
  37.     return((long *) ptr);
  38. }
  39. #endif
  40.  
  41.  
  42. #endif /* LINT /**/
  43.